<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>NeuZephyr: nz::nodes Namespace Reference</title>
<link rel="icon" href="NZ_logo2.png" type="image/x-icon" />
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="NZ_logo2.png"/></td>
  <td id="projectalign">
   <div id="projectname">NeuZephyr
   </div>
   <div id="projectbrief">Simple DL Framework</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="namespaces.html"><span>Namespace&#160;List</span></a></li>
      <li><a href="namespacemembers.html"><span>Namespace&#160;Members</span></a></li>
    </ul>
  </div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>nz</b></li><li class="navelem"><a class="el" href="namespacenz_1_1nodes.html">nodes</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#namespaces">Namespaces</a> &#124;
<a href="#nested-classes">Classes</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">nz::nodes Namespace Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Contains classes and functionality for nodes in a neural network or computational graph.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacenz_1_1nodes_1_1calc.html">calc</a></td></tr>
<tr class="memdesc:namespacenz_1_1nodes_1_1calc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Contains classes and functionality for computation nodes in a neural network or computational graph. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacenz_1_1nodes_1_1io.html">io</a></td></tr>
<tr class="memdesc:namespacenz_1_1nodes_1_1io"><td class="mdescLeft">&#160;</td><td class="mdescRight">This namespace contains standard nodes used in computational graphs for neural networks. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacenz_1_1nodes_1_1loss.html">loss</a></td></tr>
<tr class="memdesc:namespacenz_1_1nodes_1_1loss"><td class="mdescLeft">&#160;</td><td class="mdescRight">Contains loss function nodes for computing various loss metrics in a machine learning model. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classnz_1_1nodes_1_1_node.html">Node</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Base class for nodes in a neural network or computational graph.  <a href="classnz_1_1nodes_1_1_node.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a42672c2d7708ae1d0c071fd9bef6c03c" id="r_a42672c2d7708ae1d0c071fd9bef6c03c"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a42672c2d7708ae1d0c071fd9bef6c03c"><td class="memTemplItemLeft" align="right" valign="top">std::enable_if_t&lt; std::is_base_of_v&lt; <a class="el" href="classnz_1_1nodes_1_1_node.html">Node</a>, T &gt;, std::ostream &amp; &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#a42672c2d7708ae1d0c071fd9bef6c03c">operator&lt;&lt;</a> (std::ostream &amp;os, const T &amp;node)</td></tr>
<tr class="memdesc:a42672c2d7708ae1d0c071fd9bef6c03c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Overloads the <code>&lt;&lt;</code> operator to print information about a node.  <br /></td></tr>
<tr class="separator:a42672c2d7708ae1d0c071fd9bef6c03c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Contains classes and functionality for nodes in a neural network or computational graph. </p>
<p>The <code><a class="el" href="namespacenz_1_1nodes.html" title="Contains classes and functionality for nodes in a neural network or computational graph.">nz::nodes</a></code> namespace provides a collection of classes that represent various layers and operations in a neural network. Each node is an essential component of a computational graph, responsible for performing specific computations during the forward and backward passes.</p>
<p>This namespace includes:</p><ul>
<li><b><a class="el" href="classnz_1_1nodes_1_1_node.html" title="Base class for nodes in a neural network or computational graph.">Node</a> Class</b>: The abstract base class <code><a class="el" href="classnz_1_1nodes_1_1_node.html" title="Base class for nodes in a neural network or computational graph.">Node</a></code>, which defines the interface for all types of nodes. It provides the basic structure and functionality, including methods for forward and backward passes.</li>
<li><b>Derived <a class="el" href="classnz_1_1nodes_1_1_node.html" title="Base class for nodes in a neural network or computational graph.">Node</a> Classes</b>: A set of derived classes representing common operations and layers in neural networks, including activation functions, mathematical operations, and loss functions. Examples include:<ul>
<li><b>Activation Functions</b>: <code>LeakyReLUNode</code>, <code>SwishNode</code>, <code>ELUNode</code>, <code>HardSigmoidNode</code>, <code>HardSwishNode</code>, <code>SoftmaxNode</code>.</li>
<li><b>Mathematical Operations</b>: <code>AddNode</code>, <code>MatMulNode</code>, <code>ScalarMulNode</code>, <code>ScalarDivNode</code>, etc.</li>
<li><b>Loss Functions</b>: <code>MeanSquaredErrorNode</code>, <code>BinaryCrossEntropyNode</code>.</li>
</ul>
</li>
</ul>
<p>The nodes in this namespace work with <code>Tensor</code> objects to propagate data and gradients through the network, supporting the training and inference processes of deep learning models.</p>
<dl class="section note"><dt>Note</dt><dd><ul>
<li>The nodes in this namespace are designed to be used as part of a computational graph, and each node can be connected to other nodes to define the structure of a neural network.</li>
<li>Ensure proper memory management when working with tensors, particularly when dealing with GPU memory.</li>
</ul>
</dd></dl>
<dl class="section author"><dt>Author</dt><dd>Mgepahmge (<a href="https://github.com/Mgepahmge">https://github.com/Mgepahmge</a>)</dd></dl>
<dl class="section date"><dt>Date</dt><dd>2024/11/29 </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a42672c2d7708ae1d0c071fd9bef6c03c" name="a42672c2d7708ae1d0c071fd9bef6c03c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a42672c2d7708ae1d0c071fd9bef6c03c">&#9670;&#160;</a></span>operator&lt;&lt;()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">std::enable_if_t&lt; std::is_base_of_v&lt; <a class="el" href="classnz_1_1nodes_1_1_node.html">Node</a>, T &gt;, std::ostream &amp; &gt; nz::nodes::operator&lt;&lt; </td>
          <td>(</td>
          <td class="paramtype">std::ostream &amp;</td>          <td class="paramname"><span class="paramname"><em>os</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const T &amp;</td>          <td class="paramname"><span class="paramname"><em>node</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Overloads the <code>&lt;&lt;</code> operator to print information about a node. </p>
<p>The <code>operator&lt;&lt;</code> is overloaded to provide a convenient way to print detailed information about a node, including its type, data, gradient, and loss (if applicable). This operator calls the <code>print()</code> method of the node, which handles the actual formatting and output of the node's information.</p>
<p>The operator outputs the following details:</p><ul>
<li><b>Type</b>: The type of the node (e.g., the operation it represents, such as "MatrixMul", "ReLU", etc.).</li>
<li><b>Data</b>: The tensor data stored in the node's <code>output</code> tensor.</li>
<li><b>Gradient</b>: If the node has a computed gradient, it is displayed, providing insights into the gradient values being backpropagated during training.</li>
<li><b>Loss</b>: The loss value associated with the node (if applicable), which can be used to monitor the error or discrepancy in the node during the forward-backward pass.</li>
</ul>
<p>This operator is primarily used for debugging, logging, and inspecting the state of the node, including its tensor data, gradients, and any associated loss. By using the <code>&lt;&lt;</code> operator, you can easily print the node's information directly to standard output or any other output stream.</p>
<dl class="section note"><dt>Note</dt><dd><ul>
<li>The <code>print()</code> method must be implemented by the node's class (or any class derived from it). This method should handle printing the type, data, gradient, and loss for that specific class.</li>
<li>This operator is designed to be used with any class that has a <code>print()</code> method, making it a flexible and reusable solution for logging and debugging.</li>
</ul>
</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">os</td><td>The output stream (e.g., <code>std::cout</code>) to which the node's information will be printed. </td></tr>
    <tr><td class="paramname">node</td><td>The node object to be printed. It is passed as a const reference to ensure it is not modified.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The output stream (<code>os</code>), allowing the operator to be used in chain expressions like <code>std::cout &lt;&lt; node1 &lt;&lt; node2;</code>.</dd></dl>
<dl class="section author"><dt>Author</dt><dd>Mgepahmge (<a href="https://github.com/Mgepahmge">https://github.com/Mgepahmge</a>)</dd></dl>
<dl class="section date"><dt>Date</dt><dd>2024/11/29 </dd></dl>

<p class="definition">Definition at line <a class="el" href="_nodes_8cuh_source.html#l00114">114</a> of file <a class="el" href="_nodes_8cuh_source.html">Nodes.cuh</a>.</p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
